public class test {
    /*public  static  void sc (int a){
        if(a<10){
            System.out.println(a%10);
            return;
        }
        sc(a/10);
        System.out.println(a%10);
    }
    public static void main(String[] args) {
        int a = 1234;
        sc(a);
    }*/
    public  static  int sum (int a){
        if(a<10){
            return a%10;
        }
        return a%10+sum(a/10);
    }
    public static void main(String[] args) {
        int a = 1234;
        System.out.println(sum(a));
    }
}
